<template>
  <div :spinning="confirmLoading">
    <div v-show="detailfromShow" >
      <a-page-header :ghost="false" :title="projectStatus">
        <a-descriptions size="small" :column="1">
          <a-descriptions-item label="提交时间"> {{tjsj}} </a-descriptions-item>
          <a-descriptions-item label="项目编号"> {{xmbh}} </a-descriptions-item>
          <a-descriptions-item label="项目协议编号"> {{xmxybh}} </a-descriptions-item>
        </a-descriptions>
      </a-page-header>
      <a-page-header :ghost="false" title="项目基本信息"style="background-color: #F5F5F5">
        <j-form-container :disabled="true">
          <a-form :form="form" slot="detail">
            <a-row>
              <a-col :span="24">
                <a-form-item label="工作城市" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <!--<j-area-linkage v-decorator="['gzcsmc']" type="cascader"/>-->
                  <a-input v-decorator="['gzcsmc']"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="项目名称" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <a-input v-decorator="['xmmc']" placeholder="请输入项目名称"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="所属驿站" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <j-dict-select-tag type="list" v-decorator="['yzmc', { rules: [{ message: '请选择所属驿站!' }] }]" :trigger-change="true" dictCode="lhyg_corpinfo, corpname, id, qylx=1" placeholder="请选择所属驿站"></j-dict-select-tag>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="平台结算方式" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <j-dict-select-tag v-decorator="['isjs', { rules: [{ required: true, message: '请选择平台结算方式!' }] }]" dictCode="project_isjs"></j-dict-select-tag>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="职位名称" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <j-dict-select-tag v-decorator="['xmlxid', { rules: [{ required: true, message: '请选择项目类型!' }] }]" dictCode="hydm"></j-dict-select-tag>
                  <!--<a-select style="width: 100%"  v-decorator="['xmlxid', { rules: [{ required: true, message: '请选择项目类型!' }] }]">
                    <a-select-option v-for="d in xmlxDatas" :key="d.value" :value="d.value">{{d.text}}</a-select-option>
                  </a-select>-->
                </a-form-item>
              </a-col>
              <!--<a-col :span="24">-->
              <!--  <a-form-item label="所属驿站" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">-->
              <!--    <j-dict-select-tag v-decorator="['yzmc', { rules: [{ required: true, message: '请选择驿站名称!' }] }]" dictCode="yzmc"></j-dict-select-tag>-->
              <!--  </a-form-item>-->
              <!--</a-col>-->
              <!--<a-col :span="24">-->
              <!--  <a-form-item label="招聘方式" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">-->
              <!--    <j-dict-select-tag v-decorator="['zpfs', { rules: [{ required: true, message: '请选择招聘方式!' }] }]" dictCode="zpfs"></j-dict-select-tag>-->
              <!--  </a-form-item>-->
              <!--</a-col>-->
              <a-col :span="24">
                <a-form-item label="岗位职责" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <a-textarea placeholder="请输入项目内容" v-decorator="['xmnr']" :rows="4" ></a-textarea>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="任职要求" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <a-textarea placeholder="请输入验收标准" v-decorator="['ysbz']" :rows="4" ></a-textarea>
                </a-form-item>
              </a-col>
              <a-col :span="10" style="margin-left: 68px;">
                <a-form-item label="需要人数" :labelCol="{ xs: { span: 24 }, sm: { span: 6 }}" :wrapperCol="{xs: { span: 24 },sm: { span: 12 }}" style="height: 25px;">
                  <a-input-number v-decorator="['xyrs']" :precision="0" :min="0" style="width: 90%" ></a-input-number> 人
                </a-form-item>
              </a-col>
              <!--<a-col :span="10" style="margin-left: 36px;">-->
              <!--  <a-form-item label="任务总金额(元)" :labelCol="{ xs: { span: 24 }, sm: { span: 6 }}" :wrapperCol="{xs: { span: 24 },sm: { span: 10 }}" style="height: 25px;">-->
              <!--    <a-input-number v-decorator="['rwzje']" :precision="2" :min="0.01" style="width: 100%" />-->
              <!--  </a-form-item>-->
              <!--</a-col>-->
              <a-col :span="24">
                <a-form-item label="结算方式 " :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag type="radio" v-decorator="['jsfs', validatorRules.jsfs]" :trigger-change="true" dictCode="project_jsfs" placeholder="请选择结算方式 "/>
                </a-form-item>
              </a-col>
              <a-col :span="24" style="margin-left: -40px;">
                <a-form-item label="单人结算金额(元)" :labelCol="{ xs: { span: 24 }, sm: { span: 6 }}" :wrapperCol="{xs: { span: 24 },sm: { span: 10 }}" style="height: 25px;">
                  <a-input-number v-decorator="['drjsje']" :precision="2" :min="1" style="width: 100%" />
                </a-form-item>
              </a-col>
              <a-col :span="7" style="margin-left: 102px;">
                <a-form-item label="年龄要求" :labelCol="{ xs: { span: 24 }, sm: { span: 6 }}" :wrapperCol="{xs: { span: 24 },sm: { span: 10 }}" style="height: 25px;">
                  <!--<j-dict-select-tag v-decorator="['nlyq']" :triggerChange="true" dictCode="nlyq_dict"></j-dict-select-tag>-->
                  <a-input v-decorator="['nlyq']" maxLength="20" placeholder="请输入年龄要求"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="7">
                <a-form-item label="学历要求" :labelCol="{ xs: { span: 24 }, sm: { span: 6 }}" :wrapperCol="{xs: { span: 24 },sm: { span: 10 }}" style="height: 25px;">
                  <j-dict-select-tag v-decorator="['xlyq']" :triggerChange="true" dictCode="xlyq_dict"></j-dict-select-tag>
                </a-form-item>
              </a-col>
              <a-col :span="7">
                <a-form-item label="经验要求" :labelCol="{ xs: { span: 24 }, sm: { span: 6 }}" :wrapperCol="{xs: { span: 24 },sm: { span: 10 }}" style="height: 25px;">
                  <!--<j-dict-select-tag v-decorator="['jyyq']" :triggerChange="true" dictCode="jyyq_dict"></j-dict-select-tag>-->
                  <a-input v-decorator="['jyyq']" maxLength="20" placeholder="请输入经验要求"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="11" style="margin-left: 100px;">
                <a-form-item label="项目起止日" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-date-picker v-decorator="['xmqrq']" format="YYYY-MM-DD"  /> -- <a-date-picker v-decorator="['xmzrq']" format="YYYY-MM-DD" />
                </a-form-item>
              </a-col>
              <a-col :span="10">
                <a-form-item label="工作时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-time v-decorator="['gzkssj']" date-format="HH:mm" /> -- <j-time v-decorator="['gzjssj']" date-format="HH:mm"/>
                </a-form-item>
              </a-col>
            </a-row>
          </a-form>
        </j-form-container>
      </a-page-header>
      <a-page-header :ghost="false" title="报名人员信息列表" style="background-color: #F5F5F5; margin-top: 20px;">
        <div><a @click="downloadFile('https://linggongpingtai.com:9200/quickworkerlg/contractTtemp2/T2024122010090000.docx')">点击下载-解聘声明模版</a></div>
        <!--https://linggongpingtai.com:9200/quickworkerlg/contractTtemp2/2024121014005599827858622.pdf-->
        <!--https://linggongpingtai.com:9200/quickworkerlg/contractTtemp2/T2024122010090000.docx-->
        <a-table
          ref="table"
          size="middle"
          :scroll="{x:true, y:340}"
          bordered
          rowKey="id"
          :pagination="false"
          :columns="xqColumns"
          :dataSource="xqData"
          :loading="loading"
          class="j-table-force-nowrap">

        <span slot="action" slot-scope="text, record"  >
          <!--<div v-if="record.hiredStatus != '1'">-->
          <!--    <a>-</a>-->
          <!--</div>-->
          <!--hiredStatus录用状态,1已报名, 2已录用, 3已拒绝录用-->
          <!--isSign是否签署合同:0未签署, 1已签署, 2已录用待签署-->
          <div v-if="record.hiredStatus === '1' && record.isSign === '0'">
          <!--<div v-if="record.hiredStatus === '1'">-->
            <a-popconfirm title="确定要录用该人员吗?" @confirm="() => lyqht(record.id,2 )">
              <a>录用</a>
            </a-popconfirm>
            <a-divider type="vertical"/>
            <a-popconfirm title="确定不录用吗?" @confirm="() => isly(record.id,3 )" >
              <a>不录用</a>
            </a-popconfirm>
            <a-divider type="vertical"/>
            <a @click="userinfo(record.id)">简历</a>
          </div>
          <div v-if="record.hiredStatus != '1' || record.isSign != '0'">
            <a @click="userinfo(record.id)">简历</a>
            <a-divider v-if="record.isSign == 1"  type="vertical"/>
            <a v-if="record.isSign == 1" @click="downloadFile(record.htpdf)">合同下载</a>
            <a-divider v-if="record.hiredStatus === '2' || record.isSign === '2'" type="vertical"/>
            <a v-if="record.hiredStatus === '2' || (record.isSign === '2' && record.hiredStatus === '1')" @click="jieChuPinYong(record.individualid, record.projectid)">解聘</a>
          </div>
        </span>

        </a-table>
      </a-page-header>
      <a-page-header :ghost="false">
        <div style="margin-left: 22px; margin-top: 16px;" v-show="xyShow">
          <a style="font-size: 22px;" @click="detailXmxy()">查看项目协议</a>
        </div>
        <a-modal
          title="查看合同"
          :visible="visibleHz"
          width="1000px"
          cancelText="关闭"
          @cancel="HzClose"
          :okButtonProps="{ class:{'jee-hidden': true} }"
        >
          <div  id="hz" style="width:960px;height:600px;">
            <iframe style="width: 100%;height: 100%;" :src="hzImgUrl"></iframe>
          </div>

        </a-modal>
      </a-page-header>
    </div>

    <div v-show="addformShow">
      <a-page-header :ghost="false" title="项目基本信息" style="background-color: #F5F5F5"  >
        <j-form-container :disabled="formDisabled">
          <a-form :form="form" slot="detail">
            <a-row>
              <a-col :span="24">
                <a-form-item label="工作城市" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <!--<j-area-linkage v-decorator="['gzcs', { rules: [{ required: true, message: '请输入工作城市/区!' }] }]" type="cascader"/>-->
                  <a-input v-decorator="['gzcsmc', { rules: [{ required: true, message: '请输入工作城市/区!' }] }]" placeholder="请输入工作城市/区"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="项目名称" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <a-input v-decorator="['xmmc', { rules: [{ required: true, message: '请输入项目名称!' }] }]" placeholder="请输入项目名称"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="所属驿站" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <j-dict-select-tag type="list" v-decorator="['yzmc', { rules: [{ message: '请选择所属驿站!' }] }]" :trigger-change="true" dictCode="lhyg_corpinfo, corpname, id, qylx=1" placeholder="请选择所属驿站"></j-dict-select-tag>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="平台结算方式" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <j-dict-select-tag v-decorator="['isjs', { rules: [{ required: true, message: '请选择平台结算方式!' }] }]" :triggerChange="true" dictCode="project_isjs"></j-dict-select-tag>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="职位名称" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <j-dict-select-tag v-decorator="['xmlxid', { rules: [{ required: true, message: '请选择项目类型!' }] }]" :triggerChange="true" dictCode="hydm"></j-dict-select-tag>
                  <!--<a-select style="width: 100%"  v-decorator="['xmlxid', { rules: [{ required: true, message: '请选择项目类型!' }] }]">
                    <a-select-option v-for="d in xmlxDatas" :key="d.value" :value="d.value">{{d.text}}</a-select-option>
                  </a-select>-->
                </a-form-item>
              </a-col>
              <!--<a-col :span="24">-->
              <!--  <a-form-item label="所属驿站" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">-->
              <!--    <j-dict-select-tag v-decorator="['yzmc', { rules: [{ required: true, message: '请选择驿站名称!' }] }]" :triggerChange="true" dictCode="lhyg_corpinfo,corpname,id,qylx='1' order by create_time"></j-dict-select-tag>-->
              <!--  </a-form-item>-->
              <!--</a-col>-->
              <!--<a-col :span="24">-->
              <!--  <a-form-item label="招聘方式" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">-->
              <!--    <j-dict-select-tag v-decorator="['zpfs', { rules: [{ required: true, message: '请选择招聘方式!' }] }]" :triggerChange="true" dictCode="zpfs"></j-dict-select-tag>-->
              <!--  </a-form-item>-->
              <!--</a-col>-->
              <a-col :span="24">
                <a-form-item label="岗位职责" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <a-textarea placeholder="请输入项岗位职责100字符以内" v-decorator="['xmnr',{ rules: [{ required: true, message: '请输入项岗位职责100字符以内!' }] }]" :rows="4" maxLength="100"></a-textarea>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="任职要求" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <a-textarea placeholder="请输入任职要求100字符以内" v-decorator="['ysbz',{ rules: [{ required: true, message: '请输入任职要求100字符以内!' }] }]" :rows="4" maxLength="100"></a-textarea>
                </a-form-item>
              </a-col>
              <!--<a-col :span="24">-->
              <!--  <a-form-item label="任务总金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">-->
              <!--    <a-input-number v-decorator="['rwzje', { rules: [{ required: true, message: '请输入任务总金额!' }] }]" :precision="2" :min="0.01" style="width: 100%" />-->
              <!--  </a-form-item>-->
              <!--</a-col>-->
              <a-col :span="24">
                <a-form-item label="结算方式 " :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag type="radio" v-decorator="['jsfs', validatorRules.jsfs]" :trigger-change="true" dictCode="project_jsfs" @change="onChangejsfs" placeholder="请选择结算方式 " />
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="单人结算金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;"  prop="serverIp" >
                  <a-input v-decorator="['drjsje', validatorRules.drjsje]"  placeholder="请输入单人结算金额,示例:300或200-300!" maxLength="16"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="需要人数" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <a-input-number v-decorator="['xyrs', { rules: [{ required: true, message: '请输入需要人数!' }] }]" :precision="0" :min="1" style="width: 30%" @change="changeXyrs" ></a-input-number> 人
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="年龄要求" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <!--<j-dict-select-tag v-decorator="['nlyq', { rules: [{ required: true, message: '请输入年龄!' }] }, {initialValue: '0' }]" :triggerChange="true" dictCode="nlyq_dict"></j-dict-select-tag>-->
                  <a-input v-decorator="['nlyq', { rules: [{ required: true, message: '请输入年龄要求!' }] }]" maxLength="20" placeholder="请输入年龄要求"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="学历要求" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <j-dict-select-tag v-decorator="['xlyq', { rules: [{ required: true, message: '请输入学历!' }] },{initialValue: '0' }]" :triggerChange="true" dictCode="xlyq_dict"></j-dict-select-tag>
                </a-form-item>
              </a-col>
              <a-col :span="24">
                <a-form-item label="经验要求" :labelCol="labelCol" :wrapperCol="wrapperCol" style="height: 25px;">
                  <!--<j-dict-select-tag v-decorator="['jyyq',{ rules: [{ required: true, message: '请输入经验!' }] }, {initialValue: '0' }]" :triggerChange="true" dictCode="jyyq_dict"></j-dict-select-tag>-->
                  <a-input v-decorator="['jyyq', { rules: [{ required: true, message: '请输入经验要求!' }] }]" maxLength="20" placeholder="请输入经验要求"></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="12" style="margin-left: 92px;">
                <a-form-item label="项目起止日" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-date-picker v-decorator="['xmqrq', { rules: [{ required: true, message: '请选择项目起止日!' }] }]" :disabled-date="disabledStartDate" format="YYYY-MM-DD" placeholder="Start" @openChange="handleStartOpenChange" /> &#45;&#45;
                  <a-date-picker v-decorator="['xmzrq', { rules: [{ required: true, message: '请选择项目起止日!' }] }]" :disabled-date="disabledEndDate" format="YYYY-MM-DD" placeholder="End" :open="endOpen" @openChange="handleEndOpenChange" />
                </a-form-item>
              </a-col>
              <a-col :span="10">
                <a-form-item label="工作时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-time v-decorator="['gzkssj', { rules: [{ required: true, message: '请选择工作时间!' }] }]" date-format="HH:mm" /> -- <j-time v-decorator="['gzjssj', { rules: [{ required: true, message: '请选择工作时间!' }] }]" date-format="HH:mm"/>
                </a-form-item>
              </a-col>
            </a-row>
          </a-form>
        </j-form-container>
      </a-page-header>
      &nbsp;


      <a-page-header :ghost="false" title="开票信息" style="background-color: #F5F5F5; margin-top: 20px; " >
        <a-descriptions size="small" :column="2">
          <a-descriptions-item label="公司名称"> {{gsmc}} </a-descriptions-item>
          <a-descriptions-item label="纳税人识别号"> {{sh}}</a-descriptions-item>
          <a-descriptions-item label="注册地址"> {{zcdz}}</a-descriptions-item>
          <a-descriptions-item label="联系人姓名"> {{lxrxm}}</a-descriptions-item>
          <a-descriptions-item label="办公地址"> {{bgdz}}</a-descriptions-item>
          <a-descriptions-item label="联系人手机"> {{lxrsj}}</a-descriptions-item>
          <a-descriptions-item label="开户行及账号"> {{khh}} {{kh}}</a-descriptions-item>
          <a-descriptions-item label="邮箱"> {{email}}</a-descriptions-item>
        </a-descriptions>
      </a-page-header>
    </div>
    <a-modal
      title="合同"
      width="1000px"
      :visible="visibleHt"
      okText="确认签署"
      cancelText="关闭"
      @ok="startSign"
      @cancel="htClose"
      :confirm-loading="yzmspinning"
    >
      <a-spin tip="验证码发送中，请稍等..." :spinning="yzmspinning">
        <div id="ht" style="width:960px;height:600px;">
          <iframe style="width: 100%;height: 100%;" :src="htImgUrl"></iframe>
        </div>
      </a-spin>
    </a-modal>
    <a-modal
      title="验证码"
      :visible="visibleYzm"
      cancelText="关闭"
      @ok="saveCode"
      @cancel="yzmClose"
      :confirm-loading="qsspinning"
    >
      <a-spin tip="签署中，请稍等..." :spinning="qsspinning">
        <a-form-item label="请输入验证码" :labelCol="{ xs: { span: 23 }, sm: { span: 6 }}" :wrapperCol="{ xs: { span: 24 }, sm: { span: 16 }}">
          <a-input  v-model="smscode"/>
        </a-form-item>
      </a-spin>
    </a-modal>
    <!--<a-modal-->
    <!--  title="查看项目协议"-->
    <!--  :visible="visibleHz"-->
    <!--  width="1000px"-->
    <!--  cancelText="关闭"-->
    <!--  @cancel="HzClose"-->
    <!--  :okButtonProps="{ class:{'jee-hidden': true} }"-->
    <!--&gt;-->
    <!--</a-modal>-->

    <a-modal
      title="简历"
      width="1000px"
      :visible="userinfoshow"
      cancelText="关闭"
      @ok="userinfoClose"
      @cancel="userinfoClose"

    >
      <div >
        <a-page-header :ghost="false" title="应聘人信息" style="background-color: #F5F5F5; margin-top: 20px; " >
          <a-descriptions size="small" :column="2">
            <!--:visible="userinfoshow"-->
            <!--:confirm-loading="userinfoshow"-->
            <a-descriptions-item label="姓名"> {{name}} </a-descriptions-item>
            <a-descriptions-item label="性别"> {{sex}}</a-descriptions-item>
            <a-descriptions-item label="年龄"> {{age}}</a-descriptions-item>
            <a-descriptions-item label="学历"> {{xl}}</a-descriptions-item>
            <a-descriptions-item label="身份证号"> {{identityid}}</a-descriptions-item>
            <a-descriptions-item label="手机号"> {{phone}}</a-descriptions-item>
            <a-descriptions-item label="所属驿站"> {{corpname}}</a-descriptions-item>
            <!--<a-descriptions-item label="所属地区"> {{ssdq}}</a-descriptions-item>-->
            <a-descriptions-item label="意向工种"> {{yxgz}}</a-descriptions-item>
            <a-descriptions-item label="求职意向"> {{qzyx}}</a-descriptions-item>
            <a-descriptions-item label="期望薪资"> {{qwxz}}</a-descriptions-item>
            <a-descriptions-item label="工作经验"> {{gzjy}}</a-descriptions-item>
            <a-descriptions-item label="技能描述"> {{jnms}}</a-descriptions-item>
            <a-descriptions-item label="个人简介"> {{grjj}}</a-descriptions-item>
            <!--<a-descriptions-item label="工作时间"> {{gzsj}}</a-descriptions-item>-->
            <!--<a-descriptions-item label="技能证书"> {{jnzs}}</a-descriptions-item>-->
          </a-descriptions>
        </a-page-header>
      </div>
    </a-modal>
    <a-modal
      title="解除录用"
      width="1000px"
      :visible="visibleJp"
      okText="确认解除"
      cancelText="关闭"
      @ok="jpok"
      @cancel="jpClose"
    >
      <a-row :gutter="24" style="margin-top: 65px;margin-bottom:50px;">
        <a-col :span="24">
          <a-form-item label="上传解聘声明">
            <j-upload v-model="jpwj" :multiple="false" :number="1"></j-upload>
          </a-form-item>
        </a-col>
      </a-row>

    </a-modal>
  </div>


</template>

<script>

  import { httpAction, getAction, postAction } from '@/api/manage'
  import pick from 'lodash.pick'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import JFormContainer from '@/components/jeecg/JFormContainer'
  import JDictSelectTag from "@/components/dict/JDictSelectTag"
  import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
  import moment from 'moment';
  import JTime from '../../../../components/jeecg/JTime'
  import Area from '@/components/_util/Area'
  import { JVXETypes } from '@/components/jeecg/JVxeTable'
  import {initDictOptions, filterDictText} from '@/components/dict/JDictSelectUtil'
  import JUpload from '@/components/jeecg/JUpload'


  let skrIndex;
  let recordBean;
  export default {
    name: 'LhygProjectForm',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      JTime,
      JFormContainer,
      JDictSelectTag,
      JAreaLinkage,
      JUpload,
    },
    props: {
      //流程表单data
      formData: {
        type: Object,
        default: ()=>{},
        required: false
      },
      //表单模式：true流程表单 false普通表单
      formBpm: {
        type: Boolean,
        default: false,
        required: false
      },
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    data () {
      return {
        recordTest: '',
        jpwj: '',
        jpid:'',
        proid:'',
        mixin_pca:'',
        form: this.$form.createForm(this),
        confirmLoading: false,
        loading: false,
        // queryParamCX: {
        //     name: '',
        //     identityid: '',
        //     phone: '',
        // },
        tjrList: {
          name: '',
          identityid: '',
          phone: '',
          rwje: '',
          bz: '',
          usertype: ''
        },
        id: '',
        visibleHt: false,
        visibleJp: false,
        yzmspinning: false,
        qsspinning: false,
        visibleYzm: false,
        xmqrq: null,
        xmzrq: null,
        endOpen: false,
        addformShow: false,
        detailfromShow: false,
        showFlowSkr: false,
        showRwje: false,
        xyShow: false,
        userinfoshow: false,
        projectStatus: '',
        rwje: '',
        bz: '',
        xmlxDatas:[], //接收项目类型数据的对象
        gsmc: '',
        sh: '',
        email: '',
        zcdz: '',
        bgdz: '',
        lxrxm: '',
        lxrsj: '',
        khh: '',
        kh: '',
        tjsj: '',
        xmbh: '',
        smscode: '',
        xmxybh: '',
        xmlxid: '',
        isjs: '',
        yzmc:'',
        zpfs:'',
        name:'',//姓名
        identityid:'',//身份证号
        phone:'',//手机号
        corpname:'',//所属驿站
        ssdq:'',//所属地区
        sex:'',//性别
        age:'',//年龄
        yxgz:'',//意向工种
        qzyx:'',//求职意向
        qwxz:'',//期望薪资
        gzjy:'',//工作经验
        xl:'',//学历
        grjj:'',//个人简介
        jnms:'',//技能描述
        gzsj:'',//工作时间: 多选1白班, 2夜班, 3周末班
        jnzs:'',//技能证书
        xyrs_form: 0,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 4 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 19 },
        },
        validatorRules: {
          jsfs: {
            rules: [
              { required: true, message: '请选择结算方式 !'},
            ]
          },
          drjsje: {
            rules: [
              // { required: true, message: '请选择结算方式 !'},
              { pattern: /^[1-9]+(\d+-)*\d+$/, message: '请输入正确的金额格式,例如200 或 200-300!'},
            ]
          }
        },
        url: {
          add: "/project/lhygProject/add",
          edit: "/project/lhygProject/edit",
          queryById: "/project/lhygProject/queryById",
          // getGTHList: "/project/lhygProject/getGTHList",
          saveSkrUrl: "/project/lhygProjectIndividual/addList",
          getSkrList: "/project/lhygProject/getSkrList",
          deleteBatch: "project/lhygProjectIndividual/deleteBatch",
          // getXmlxDatas: "project/lhygProject/getXmlxDatas",
          queryKpInfo: "project/lhygProject/queryKpInfo",
          // getQyUserList: "/project/lhygProject/getQyUserList",
          importExcelUrl:"project/lhygProject/importSkrExcel",
          // sendZcMessage: "/project/lhygProject/sendZcMessage",
          getSkrInfo: "/project/lhygProject/getSkrInfo",
          islyurl: "project/lhygProject/isly",
          qyqsxmxy: "project/lhygProject/qyqsxmxy",
          getStartSign:"/project/lhygProject/qyStartSign",
          qytoSign:"/project/lhygProject/qytoSign",
          updateStatus: "/project/lhygProject/updateStatus",
          getSms:"/project/lhygProject/qySmsCode",
          userinfo:"/wx/lhygWxUser/queryUserById",
          jp:"/project/lhygProjectIndividual/jp",
        },
        skrData: [],
        skrColumns: [
          {
              title:'姓名',
              align:"center",
              /*dataIndex: 'name',
              width: 140*/
              key: 'name',
              type: JVXETypes.normal,
              width: '140px',
          },
          {
              title:'身份证号',
              align:"center",
              /*dataIndex: 'identityid',
              width: 220*/
              key: 'identityid',
              type: JVXETypes.normal,
              width: '220px',
          },
          {
              title:'手机号',
              align:"center",
              /*dataIndex: 'phone',
              width: 160*/
              key: 'phone',
              type: JVXETypes.normal,
              width: '200px',
          },
          {
              title:'任务金额（元）',
              align:"center",
              /*dataIndex: 'rwje',
              width: 160,
              ellipsis: true,*/
              key: 'rwje',
              type: JVXETypes.inputNumber,
              width: '160px',
              validateRules: [
                  {
                      required: true, // 必填
                      message: '请输入${title}' // 显示的文本
                  },
                  {
                      pattern: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/,  ///^(([0-3]{0,1}[0-9]{0,4})|(([0]\.\d{1,2}|[0-3]{0,1}[0-9]{0,4}\.\d{1,2})))$/, // 正则
                      message: '${title}必须为正数且最多输入两位小数'
                  },
              ]
          },
          {
              title:'备注',
              align:"center",
              /*dataIndex: 'bz',
              ellipsis: true,*/
              key: 'bz',
              type: JVXETypes.textarea
          },
          {
              title:'人员状态',
              align:"center",
              key: 'usertype',
              type: JVXETypes.normal,
          },
          {
              /*dataIndex: 'action',
              align:"center",
              fixed:"right",
              width: 100,
              scopedSlots: { customRender: 'action' }*/
              title: '操作',
              key: 'action',
              type: JVXETypes.slot,
              fixed: 'right',
              width: '130px',
              align: 'center',
              slotName: 'action',
          }
        ],
        /* table选中keys*/
        selectedRowKeys: [],
        /* table选中records*/
        selectionRows: [],
        // selectedCXRowKeys: [],
        // selectionCXRows: [],
        // Data: [],
        // columns: [
        //   {
        //       title:'姓名',
        //       align:"center",
        //       dataIndex: 'name',
        //       width: 200
        //   },
        //   {
        //       title:'身份证号',
        //       align:"center",
        //       dataIndex: 'identityid',
        //       width: 300
        //   },
        //   {
        //       title:'手机号',
        //       align:"center",
        //       dataIndex: 'phone',
        //       width: 200
        //   },
        // ],
        visibleHz: false,
        hzImgUrl:'',
        pageNumHt:1,
        pageTotalNumHt:1,
        xqData: [],
        xqColumns: [
            {
                title:'姓名',
                align:"center",
                dataIndex: 'name',
                width: 150
            },
            {
                title:'身份证号',
                align:"center",
                dataIndex: 'identityid',
                width: 200
            },
            {
                title:'手机号',
                align:"center",
                dataIndex: 'phone',
                width: 150
            },
            {
                title:'任务金额（元）',
                align:"center",
                dataIndex: 'rwje',
                width: 150
            },
            {
                title:'是否完成',
                align:"center",
                dataIndex: 'sfwc',
                width: 150,
                customRender:function (text,record,index) {
                    if(record.status > 2){
                        return "是"
                    } else if(record.status > 0) {
                        return "否"
                    } else {
                        return "-"
                    }
                }
            },
          {
            title:'当前状态',
            align:"center",
            dataIndex: 'hiredStatus',
            width: 150,
            customRender:function (text,record,index) {
              if(record.hiredStatus === '1'){
                return "已报名"
              } else if(record.hiredStatus === '2') {
                return "已录取"
              } else if(record.hiredStatus === '3') {
                return "已拒绝"
              } else if(record.hiredStatus === '4') {
                return "解聘审批中"
              } else if(record.hiredStatus === '5') {
                return "已解聘"
              }
            }
          },
          {
            title:'签约状态',
            align:"center",
            dataIndex: 'isSign',
            width: 150,
            customRender:function (text,record,index) {
              if(record.isSign === '0'){
                return "未签署"
              } else if(record.isSign === '1') {
                return "已签署"
              } else if(record.isSign === '2') {
                return "已录用待签署"
              }
            }
          },
            {
                title:'结算金额（元）',
                align:"center",
                dataIndex: 'fkje',
                width: 150,
                customRender:function (text,record,index) {
                    if(record.status == 8){
                      return text
                    } else {
                        return "-"
                    }
                }
            },
            {
              title: '操作',
              dataIndex: 'action',
              align:"center",
              fixed:"right",
              width:200,
              scopedSlots: { customRender: 'action' }
            },
        ],
      }
    },
    computed: {
      importExcelUrl: function () {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
      formDisabled(){
        if(this.formBpm===true){
          if(this.formData.disabled===false){
            return false
          }
          return true
        }
        return this.disabled
      },
      showFlowSubmitButton(){
        if(this.formBpm===true){
          if(this.formData.disabled===false){
            return true
          }
        }
        return false
      }
    },
    created () {
      //如果是流程中表单，则需要加载流程表单data
      this.showFlowData();
      // this.fetchXmlxData();
      this.initDictConfig();
      this.getKpInfo();
      this.mixin_pca = new Area();
    },
    methods: {
      moment,
      // onChangejsfs(e){
      //   this.drjsje=e
      //   var pt = "";
      //   var msg = "";
      //   if(e == 0){
      //     msg = '请输入正确的IPv4地址';
      //     this.form.validateFields((errs, values) => {
      //       if (!errs) {
      //         // 进行下一操作，如查询
      //       }
      //     })
      //
      //     this.form.validateFields(['drjsje'], rules: [{ required:true,message:"请输入正确的IPv4地址",force: true }]);
      //   }
      // },
      add () {
        this.edit({});
      },
      edit (record) {
        recordBean = record;
        this.recordTest = record;
        this.addformShow = true;
        this.detailfromShow = false;
        this.xyShow = false;
        this.form.resetFields();
        this.visible = true;
        if(JSON.stringify(record) == '{}'){
            this.skrData = [];
        } else {
            this.xyrs_form = record.xyrs;
            let formData=new FormData();
            formData.append('id',record.id);
            formData.append('xmlxid', record.xmlxid);
            formData.append('type', "3");
            postAction(this.url.getSkrList, formData).then(res => {
                if (res.success) {
                    this.skrData = res.result;
                } else {
                    this.$message.warning(res.message);
                }
            }).catch((e) => {
                this.$message.error('查询任务接收者列表时异常');
            });
        }
        this.model = Object.assign({}, record);
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model,'gzcsmc','xmmc','isjs','xmlxid','yzmc','zpfs','xmnr','ysbz','xmzys','xyrs','nlyq','xlyq','jyyq','xmqrq','xmzrq','gzkssj','gzjssj','rwzje',
              'gsmc', 'sh', 'email', 'zcdz', 'bgdz', 'lxrxm', 'lxrsj', 'khh',  'kh' , 'drjsje','jsfs','isSing'))
        })
      },
      detailRecord (record){
          let detail_this = this;
          recordBean = record;
          detail_this.addformShow = false;
          detail_this.detailfromShow = true;
          detail_this.form.resetFields();
          detail_this.model = Object.assign({}, record);
          detail_this.visible = true;
          detail_this.id = record.id;
          detail_this.xmbh = record.xmbh;
          detail_this.tjsj = record.tjsj;
          detail_this.xmxybh = record.xmxybh;
          detail_this.projectStatus = record.status_dictText;
          if(record.isSign == '1'){
              detail_this.xyShow = true;
              detail_this.hzImgUrl = record.htpdf;
          }

          let formData=new FormData();
          formData.append('id',record.id);
          formData.append('xmlxid', record.xmlxid);
          formData.append('type', "3");
          postAction(this.url.getSkrList, formData).then(res => {
              if (res.success) {
                  this.xqData = res.result;
              } else {
                  this.$message.warning(res.message);
              }
          }).catch((e) => {
              this.$message.error('查询任务接收者列表时异常');
          });

          detail_this.$nextTick(() => {
              detail_this.form.setFieldsValue(pick(detail_this.model,'gzcsmc','xmmc','isjs','xmlxid','yzmc','zpfs','xmnr','ysbz','xmzys','xyrs','nlyq','xlyq','jyyq','xmqrq','xmzrq','gzkssj','gzjssj','rwzje',
                  'gsmc', 'sh', 'email', 'zcdz', 'bgdz', 'lxrxm', 'lxrsj', 'khh',  'kh' , 'id' , 'drjsje','jsfs','isSing'))
          })
      },

      pushSkrList(){
        let formData=new FormData();
        formData.append('id',recordBean.id);
        formData.append('xmlxid', recordBean.xmlxid);
        formData.append('type', "3");
        postAction(this.url.getSkrList, formData).then(res => {
          if (res.success) {
            this.xqData = res.result;
          } else {
            this.$message.warning(res.message);
          }
        }).catch((e) => {
          this.$message.error('查询任务接收者列表时异常');
        });
      },

      //渲染流程表单数据
      showFlowData(){
        if(this.formBpm === true){
          let params = {id:this.formData.dataId};
          getAction(this.url.queryById,params).then((res)=>{
            if(res.success){
              this.edit (res.result);
              console.log("返回的数据信息:"+res.result);
            }
          });
        }
      },
      submitForm () {
        const that = this;
        that.$emit('changeLoading',true);
        // 触发表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!that.model.id){
              httpurl+=that.url.add;
              method = 'post';
            }else{
              httpurl+=that.url.edit;
               method = 'put';
            }
            let formData = Object.assign(that.model, values);
            if(formData.isjs == 0){
              //不通过平台,自主招聘
              formData.zpfs = 1;
            }else if(formData.isjs == 1){
              //通过平台,自主招聘
              formData.zpfs = 1;
            }else if(formData.isjs == 2){
              //项目外包
              formData.zpfs = 0;
            }

            var regex = /^[1-9]+(\d+-)*\d+$/; // 正则表达式，匹配一个或多个数字，以及在数字对之间可能存在的连字符

            if(formData.jsfs != 0 &&(formData.drjsje==undefined || formData.drjsje=="" || !regex.test(formData.drjsje)) ){
              that.$message.warning("请输入有效的单人结算金额");
              setTimeout(function () {
                that.$emit('changeLoading',false);
              }, 2000)
              return ;
            }else if(formData.jsfs == 0 && formData.drjsje!=undefined && formData.drjsje!="" && !regex.test(formData.drjsje)){
              that.$message.warning("请输入有效的单人结算金额或不填");
              setTimeout(function () {
                that.$emit('changeLoading',false);
              }, 2000)
              return ;
            }

            var gzkssj = formData.gzkssj.replace(":","");
            var gzjssj = formData.gzjssj.replace(":","");

            if(parseInt(gzjssj)<=parseInt(gzkssj)){
              that.$message.warning("工作结束时间不能小于工作开始时间");
              setTimeout(function () {
                that.$emit('changeLoading',false);
              }, 2000)
              return ;
            }

            var qrq0 = formData.xmqrq;
            var zrq0 = formData.xmzrq;
            const qrq = new Date(qrq0);
            const zrq = new Date(zrq0);
            let dayNumber = Math.ceil((zrq-qrq)/(1000*60*60*24));
            if(parseInt(dayNumber)>=365) {
              that.$message.warning("项目起止日期不能超过一年");
              setTimeout(function () {
                that.$emit('changeLoading', false);
              }, 2000)
              return;
            }

            // that.model.gzcsmc = that.mixin_pca.getText(values.gzcs);
            that.model.xmlx = that.xmlxDatas.find(xmlx => xmlx.value === values.xmlxid)['text'];
            let rwrMap = {};
            let idFlag = false;
            let sjMap = {};
            let sjFlag = false;
            let errSkr = false;
            let lpiData = [];
            let errNum = 0;
            let lineNum = "";
            let lineCount = 0;
            const reg = /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
            that.skrData.forEach((item,i) => {
              if(!rwrMap[that.skrData[i].identityid]){
                  rwrMap[that.skrData[i].identityid] =  true;
              } else {
                  idFlag = true;
                  return;
              }
              if(!sjMap[that.skrData[i].phone]){
                  sjMap[that.skrData[i].phone] = true;
              } else {
                  sjFlag = true;
                  return;
              }
              lineCount += 1;
              if(that.skrData[i].usertype == '黑名单' || that.skrData[i].usertype == '手机号与身份信息不符'){
                  errSkr = true;
              }
              if(that.skrData[i].rwje == undefined || that.skrData[i].rwje == '' || !reg.test(that.skrData[i].rwje)){
                errNum += 1;
                lineNum = lineNum + (i+1) + " , ";
                return;
              } else {
                let lpi = {
                  projectid: '', individualid: '', individualphone: '', individualname: '',
                  individualcard: '', phone: '',  rwje: '', fkje: '',  bz: ''
                };
                lpi.individualid = that.skrData[i].id;
                lpi.individualphone = that.skrData[i].phone;
                lpi.individualname = that.skrData[i].name;
                lpi.individualcard = that.skrData[i].identityid;
                lpi.rwje = that.skrData[i].rwje;
                lpi.fkje = that.skrData[i].rwje;
                lpi.bz = that.skrData[i].bz;
                lpiData.push(lpi);
              }
            })

            if(lineCount > values.xyrs){
                that.$message.warning("任务接收人列表人数多于需要人数，请酌情删减或调整需要人数！");
                setTimeout(function () {
                    that.$emit('changeLoading',false);
                }, 2000)
                return ;
            } else if(errSkr)　{
                that.$message.warning("任务接收人列表存在异常用户（黑名单、手机号与身份信息不符），请调整！");
                setTimeout(function () {
                    that.$emit('changeLoading',false);
                }, 2000)
                return ;
            } else if(idFlag){
                that.$message.warning("任务接收人列表存在身份证号重复情况，请确认调整！");
                setTimeout(function () {
                    that.$emit('changeLoading',false);
                }, 2000)
                return ;
            } else if(sjFlag){
                that.$message.warning("任务接收人列表存在手机号重复情况，请确认调整！");
                setTimeout(function () {
                    that.$emit('changeLoading',false);
                }, 2000)
                return ;
            } else if(errNum > 0){
              that.$message.warning("请为第 "+lineNum.substring(0, lineNum.length-2)+" 行任务接收人指定正确的任务金额！");
              setTimeout(function () {
                  that.$emit('changeLoading',false);
              }, 2000)
              return ;
            } else {
              console.log("表单提交数据",formData)
              httpAction(httpurl,formData,method).then((res)=>{
                if(res.success){
                  let formData = new FormData();
                  formData.append("projectid", res.result.id);
                  formData.append("lpiStr", JSON.stringify(lpiData));
                  postAction(that.url.saveSkrUrl, formData ).then(res => {
                    if (res.success) {
                      that.skrData = [];
                      that.xyrs_form = 0;
                      that.onClearSelected();
                      that.$message.success(res.message);
                      setTimeout(function () {
                        that.$emit('changeLoading',false);
                      }, 2000)
                      that.$emit('ok');
                    } else {
                      setTimeout(function () {
                        that.$emit('changeLoading',false);
                      }, 2000)
                      that.$message.warning(res.message);
                    }
                  }).catch((e) => {
                    setTimeout(function () {
                      that.$emit('changeLoading',false);
                    }, 2000)
                    that.$message.error('保存接收者列表时异常');
                    that.confirmLoading = false;
                  });
                }
              }).finally(() => {
                setTimeout(function () {
                  that.$emit('changeLoading',false);
                }, 2000)
                that.confirmLoading = false;
              })
            }
          } else {
            setTimeout(function () {
              that.$emit('changeLoading',false);
            }, 2000)
          }
        })
      },
      cancel(){
          this.xyrs_form = 0;
          this.onClearSelected();
      },
      popupCallback(row){
        this.form.setFieldsValue(pick(row,'gzcsmc','xmmc','isjs','xmlxid','yzmc','zpfs','xmnr','ysbz','xmzys','xyrs','nlyq','xlyq','jyyq','xmqrq','xmzrq','gzkssj','gzjssj','rwzje',
            'gsmc', 'sh', 'email', 'zcdz', 'bgdz', 'lxrxm', 'lxrsj', 'khh',  'kh' , 'drjsje','jsfs','isSing'))
      },
      onSelectChange(selectedRowKeys, selectionRows) {
          this.selectedRowKeys = selectedRowKeys;
          this.selectionRows = selectionRows;
      },
      /*onSelectCXChange(selectedCXRowKeys, selectionCXRows) {
        this.selectedCXRowKeys = selectedCXRowKeys;
        this.selectionCXRows = selectionCXRows;
      },*/
      onClearSelected() {
          this.selectedRowKeys = [];
          this.selectionRows = [];
      },
      /*onClearCXSelected() {
          this.selectedCXRowKeys = [];
          this.selectionCXRows = [];
      },*/
      AddSkr(){
        let that =  this;
        // that.getQyUserList();
        that.showFlowSkr = true;
      },
      /*EditSkr(record, index){
          skrIndex = index;
          this.rwje = record.rwje;
          this.bz = record.bz;
          this.showRwje = true;
      },*/
      /*getQyUserList(){
          postAction(this.url.getQyUserList, this.queryParamCX).then((res) => {
              if (res.success) {
                  this.Data = res.result;
              }
              if(res.code===510){
                  this.$message.warning(res.message)
              }
          })
      },*/
      // getGTHList() {
      //     if(this.queryParamCX.name == "" && this.queryParamCX.identityid == "" && this.queryParamCX.phone == ""){
      //         this.$message.warning("请输入查询参数精准查询")
      //     } else {
      //         postAction(this.url.getGTHList, this.queryParamCX).then((res) => {
      //             if (res.success) {
      //                 this.Data = res.result;
      //             } else {
      //                 this.$message.warning(res.message)
      //             }
      //         })
      //     }
      // },
      handleOk(e) {
          let ok_this = this;
          let parphone = /^[1][3,4,5,7,8,9][0-9]{9}$/;
          let idReg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
          if(ok_this.tjrList.name == "" || ok_this.tjrList.name == undefined){
              ok_this.$message.warning("请输入被推荐人姓名");
              return;
          } else if(!idReg.test(ok_this.tjrList.identityid)){
              ok_this.$message.warning("身份证号输入错误");
              return;
          } else if(!parphone.test(ok_this.tjrList.phone)){
              ok_this.$message.warning("手机号格式输入错误");
              return;
          } else if(ok_this.tjrList.rwje == "" || ok_this.tjrList.rwje == undefined){
              ok_this.$message.warning("请指定被推荐人任务金额");
              return;
          } else {
              let formData=new FormData();
              formData.append('phone', ok_this.tjrList.phone);
              formData.append('identityid', ok_this.tjrList.identityid);
              formData.append('xmlxid', recordBean.xmlxid);
              formData.append('type', 1);
              postAction(ok_this.url.getSkrInfo, formData).then(res => {
                  if (res.success) {
                      ok_this.tjrList.usertype = res.result.usertype;
                      ok_this.skrData.push(ok_this.tjrList);
                  } else {
                      ok_this.$message.warning(res.message);
                  }
                  ok_this.handleCancel();
              }).catch((e) => {
                  ok_this.$message.error("查询用户是否注册工商户时异常");
                  ok_this.handleCancel();
              });
          }
      },
      handleCancel(e) {
          this.showFlowSkr = false;
          this.tjrList = {
              name: '',
              identityid: '',
              phone: '',
              rwje: '',
              bz: '',
              usertype: ''
          };
          // this.onClearCXSelected();
      },
      Rowclick(record, index) {
          return {
              on: {
                  click: () => {},
                  dblclick: () => {
                      skrIndex = index;
                      this.rwje = record.rwje;
                      this.bz = record.bz;
                      this.showRwje = true;
                  }
              }
          };
      },
      jeOk(e) {
          let ok_this = this;
          ok_this.skrData[skrIndex].rwje = ok_this.rwje;
          ok_this.skrData[skrIndex].bz = ok_this.bz;
          ok_this.showRwje = false;
      },
      jeCancel(e) {
          this.showRwje = false;
      },
      /*batchDel: function () {  //a-table的删除
          let del_this = this;
          if (del_this.selectedRowKeys.length <= 0) {
              del_this.$message.warning('请选择一条记录！');
              return;
          } else {
              for (var a = 0; a < del_this.selectedRowKeys.length; a++) {
                  del_this.skrData.some((item,i) => {
                      if(del_this.selectedRowKeys[a] == item.id){
                          del_this.skrData.splice(i, 1);
                          return true;
                      }
                  })
              }
              del_this.onClearSelected();
          }
      },*/
      // fetchXmlxData(){
      //   getAction(this.url.getXmlxDatas, null).then((res)=>{
      //       if(res.success){
      //           const result = res.result
      //           result.forEach((r)=>{
      //               this.xmlxDatas.push({
      //                   value:r.value,
      //                   text:r.text
      //               })
      //           })
      //       }
      //   });
      // },
      initDictConfig() {
        //初始化字典 - 性别
        initDictOptions('hydm').then((res) => {
          if (res.success) {
            this.xmlxDatas = res.result;
          }
        });
      },
      getKpInfo(){
        postAction(this.url.queryKpInfo, null).then((res)=>{
          if(res.success){
            const result = res.result;
            this.gsmc = result.gsmc;
            this.sh = result.sh;
            this.email = result.email;
            this.zcdz = result.zcdz;
            this.bgdz = result.bgdz;
            this.lxrxm = result.lxrxm;
            this.lxrsj = result.lxrsj;
            this.khh = result.khh;
            this.kh = result.kh;
            this.ptzhfwfl = result.ptzhfwfl;
          }
        });
      },

      //录用并签署企业项目和平台之间的合同
      lyqht(id,str){
        let that = this;
        if(2==str){
          that.spinning = true;
          //选择录用,先看企业是否与平台已签署合同,如果未签署则需要先签署合同
          postAction(this.url.qyqsxmxy,{"id":this.id}).then((res)=>{
            that.spinning = false
            if(res.success){
              if(res.result.isSign == '1' || res.result.qylx == '1'){
                //已签署合同的执行下一步录用 或 驿站发布项目不签署合同
                that.isly(id,str);
              }else{
                //1. (自主招聘)企业选择自行结算，不走平台结算。则企业和平台签署 委托代理招聘服务合同
                //2. (外包)企业选择委托平台进行招聘，并走平台结算。则企业和平台需签署 项目服务外包协议。平台和个人签署劳动合同书
                that.htImgUrl = res.result.htpdf;
                that.xybh = res.result.xmxybh;
                this.visibleHt = true;
              }
            }else{
              this.visibleHt = false;
              that.$message.warning(res.message);
            }
          })
        }
      },

      isly(id,str){
        postAction(this.url.islyurl, {"xmbh":this.id,"persionid":id,"isly":str}).then((res)=>{
          if(res.success){
            this.$message.success("操作成功");
            this.pushSkrList();
            //this.$emit('ok');
          }else{
            this.$message.error(res.message);
          }
        });
      },

      //解除聘用
      jieChuPinYong(id, proid){
        // let that = this;
        this.jpwj='';
        this.jpid=id;
        this.proid=proid;
        this.visibleJp = true;
      },
      // searchQuery(){
      //   this.getGTHList();
      // },
      // searchReset(){
      //   this.queryParamCX.name = '';
      //   this.queryParamCX.identityid = '';
      //   this.queryParamCX.phone = '';
      //   // this.getQyUserList();
      // },
      detailXmxy(){
          this.visibleHz = true
      },
      HzClose(){
          this.visibleHz = false;
      },
      userinfoClose(){
          this.userinfoshow = false;
      },
      downHz(){
          var url = recordBean.htpdf;
          var tempLink = document.createElement("a");
          tempLink.style.display = "none";
          tempLink.href = url;
          tempLink.setAttribute("download", '213123');
          if (typeof tempLink.download === "undefined") {
              tempLink.setAttribute("target", "_blank");
          }
          document.body.appendChild(tempLink);
          tempLink.click();
          document.body.removeChild(tempLink);
          this.visibleHz = false
      },
      // 上一页
      prePageHt() {
          let page = this.pageNumHt
          page = page > 1 ? page - 1 : 1
          this.pageNumHt = page
          document.getElementById('hz').scrollTop = 0;
      },
      // 下一页
      nextPageHt() {
          let page = this.pageNumHt
          page = page < this.pageTotalNumHt ? page + 1 : this.pageTotalNumHt
          this.pageNumHt = page
          document.getElementById('hz').scrollTop = 0;
      },
      disabledStartDate(current) {
          return  current && current < moment().subtract(1,'day');
      },
      disabledEndDate(current) {
          if (this.form.getFieldValue('xmqrq')==null || this.form.getFieldValue('xmqrq')==""){
              return
          }
          let dt = new Date(this.form.getFieldValue('xmqrq'));
          return current && current < dt

      },
      handleStartOpenChange(open) {
          if (!open) {
              this.endOpen = true;
          }
      },
      handleEndOpenChange(open) {
          this.endOpen = open;
      },
      changeXyrs(value){
        this.xyrs_form = value;
      },
      handleDL(props) {
        // 调用删除方法
        this.skrData.some((item,i) => {
            if(props.row.id == item.id){
                this.skrData.splice(i, 1);
                return true;
            }
        })
      },
      htClose(){
        this.yzmspinning = false;
        this.visibleHt = false
      },
      jpClose(){
        this.visibleJp = false
      },
      jpok(){
        var that = this;
        let formData=new FormData();
        if(that.jpwj.length<1){
          that.$message.warning("请上传解聘说明文件");
          return;
        }
        formData.append('id',that.jpid);
        formData.append('jpwj',that.jpwj);
        postAction(that.url.jp, formData).then((res) => {
          if (res.success) {
            that.$message.success(res.message);
            // this.refreshRegistrationList();
            this.pushSkrList();
            this.visibleJp=false;
            // this.skrData = [];
            // this.edit (recordBean);
            // that.searchQuery()  // 刷新列表
          } else {
            that.$message.warning(res.message);
          }
        });
        // const that = this;
            // let formData = Object.assign(that.model, values);
            // alert("内容:"+that.jpwj+","+jpwj.length);
            // alert("内容:"+this.jpwj+","+this.jpwj.length);
      },

      refreshRegistrationList(){
          // var that = this;
          this.skrData = [];
          let formData=new FormData();
          formData.append('id',this.proid);
          formData.append('xmlxid', "1");
          formData.append('type', "3");
          postAction(this.url.getSkrList, formData).then(res => {
              if (res.success) {
                this.skrData.push(res.result);
                // this.refresh();
              } else {
                  this.$message.warning(res.message);
              }
          }).catch((e) => {
              this.$message.error('查询任务接收者列表时异常');
          });
      },
      yzmClose(){
        this.smscode = '';
        this.qsspinning = false;
        this.visibleYzm = false
      },
      startSign(){
        const that = this;
        that.yzmspinning = true;
        getAction(that.url.getStartSign, {xybh: that.xybh}).then((res) => {
          if (res.success) {
            recordBean = res.result;
            that.htClose();
            that.sendMessage();
          } else {
            that.$message.error(res.message);
          }
        });
      },
      sendMessage(){
        const that = this;
        that.visibleYzm = true;
        postAction(that.url.getSms, recordBean).then((res) => {
          that.yzmspinning = false;
          if (res.success) {
            that.$message.success("验证码发送成功")
          }else{
            that.$message.error("验证码发送失败")
          }
        });
      },
      saveCode(){
        const that = this;
        that.qsspinning = true;
        getAction(that.url.qytoSign, {smscode:that.smscode, id:recordBean.id}).then((res) => {
          if (res.success){
            that.$message.success("签署成功,请再次点击录用");
            //that.updateStatus();
            setTimeout(function () {
              that.smscode = '';
              that.visibleYzm = false
              that.visibleHt = false;
              that.qsspinning = false;
              that.loadData()
            }, 1400)
          }else{
            that.qsspinning = false;
            that.$message.error(res.message)
          }
        });
      },
      updateStatus(){
        var that = this;
        let formData=new FormData();
        formData.append('id',recordBean.id);
        // formData.append('id','1723955357226139649');
        formData.append('status',2);
        postAction(that.url.updateStatus, formData).then((res) => {
          if (res.success) {
            that.$message.success(res.message);
            that.searchQuery()  // 刷新列表
          } else {
            that.$message.warning(res.message);
          }
        });
      },
      userinfo(id){
        var that = this;
        // let formData=new FormData();
        // formData.append('id',id);
        getAction(that.url.userinfo, {id:id}).then((res) => {
          if(res.success){
            that.userinfoshow = true;
            const result = res.result;
            this.name = result.name,//身份证号
            this.identityid = result.identityid,//身份证号
            this.phone = result.phone,//手机号
            this.corpname = result.corpname,//所属驿站
            this.ssdq = result.ssdq,//所属地区
            this.sex = result.sex,//性别
            this.age = result.age,//年龄
            this.yxgz = result.yxgz,//意向工种
            this.qzyx = result.qzyx,//求职意向
            this.qwxz = result.qwxz,//期望薪资
            this.gzjy = result.gzjy,//工作经验
            this.xl = result.xl,//学历
            this.grjj = result.grjj,//个人简介
            this.jnms = result.jnms,//技能描述
            this.gzsj = result.gzsj,//工作时间: 多选1白班, 2夜班, 3周末班
            this.jnzs = result.jnzs//技能证书
          } else {
            that.$message.warning(res.message);
          }
        });
      }
      /*sendZcMessage(props){
          let that = this;
          if(props.row.phone == null || props.row.phone == "" || props.row.phone == undefined){
              that.$message.warning("此任务接收人手机号为空，无法发送短信");
          } else if(props.row.rwje == null || props.row.rwje == "" || props.row.rwje == undefined){
              that.$message.warning("此任务接收人任务金额为空，请录入任务金额");
          } else {
              getAction(that.url.sendZcMessage, {phone:props.row.phone, rwje:props.row.rwje}).then((res) => {
                  if (res.success){
                      that.$message.success(res.message);
                  }else{
                      that.$message.error(res.message)
                  }
              });
          }
      },*/
    }
  }
</script>
